package com.jingdianjichi.subject.infra.basic.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingdianjichi.subject.infra.basic.entity.SubjectLabel;
import com.jingdianjichi.subject.infra.basic.service.SubjectLabelService;
import com.jingdianjichi.subject.infra.basic.mapper.SubjectLabelMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
* @author 20432
* @description 针对表【subject_label(标签)】的数据库操作Service实现
* @createDate 2025-10-03 16:36:38
*/
@Service
@Slf4j
public class SubjectLabelServiceImpl extends ServiceImpl<SubjectLabelMapper, SubjectLabel>
    implements SubjectLabelService{


    @Resource
    private SubjectLabelMapper subjectLabelMapper;
    @Override
    public SubjectLabel queryById(Long id) {
        SubjectLabel subjectLabel = subjectLabelMapper.queryById(id);
        return subjectLabel;
    }

    @Override
    public void insert(SubjectLabel subjectLabel) {
        subjectLabelMapper.insert(subjectLabel);
    }

    @Override
    public List<SubjectLabel> queryLabelList(SubjectLabel subjectLabel) {
        List<SubjectLabel> subjectCategories= subjectLabelMapper.queryLabelList(subjectLabel);
        return subjectCategories;
    }

    @Override
    public void removeByLabelId(Long id) {
        subjectLabelMapper.removeByLabelId(id);
    }

    @Override
    public void updateInfo(SubjectLabel subjectLabel) {
        subjectLabelMapper.updateInfo(subjectLabel);
    }

    @Override
    public List<SubjectLabel> batchQueryByLabelIds(List<Long> labelIds) {
        List<SubjectLabel> subjectLabels = subjectLabelMapper.batchQuery(labelIds);
        log.info("批量查询标签: {}", subjectLabels);
        if(subjectLabels == null || subjectLabels.isEmpty()){
            return Collections.emptyList();
        }
        return subjectLabels;
    }
}




